|
|
You can use VB.Net class to get the local IP or by using Winsock Object
I don't know if they are both the same (Winsock is included in vb.net class)
#1
Dim _WinSock As Object
Dim _LocalIP As String
_WinSock = CreateObject("mswinsock.winsock")
_LocalIP = Trim(_WinSock.LocalIP)
Debug.print(_LocalIP)
#2
Dim _HostName = System.Net.Dns.GetHostName()
Dim _IPAdress = System.Net.Dns.GetHostAddresses(_HostName)(0).ToString
Debug.Print(_IPAdress)
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Hi,
your computer does not know what its public IP address is, since that depends on how you connect to the internet; intervening devices (your DSL modem, your provider, ..) can alter your public IP address. The only way to get it, is by getting it returned from some web site.
I have a page that does exactly that: http://www.perceler.com/getipadr1.php[^]. Send a WebRequest for it, and get the Response.
|
|
|
|
|
Nice Site
And here is the code to do it.
Dim _xmlHTTP
Dim _URL As String
_xmlHTTP = CreateObject("MSXML2.XMLHTTP")
_URL = "http://www.perceler.com/getipadr1.php"
_xmlHTTP.Open("GET", _URL, False)
_xmlHTTP.Send()
Debug.Print(_xmlHTTP.responseText)
Is that what you mean by WebRequest ?
I am asking to learn more feature. Thanks.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
|
Hi Luc,
Almost all my example depends on object (WMI or CreateObject) which I used to use in VFP, So that i am trying to find VB.Net Pure code.
Thanks for the link, Very Usefull
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Hi again,
I have added example code to my web page on getipadr1[^].
It is C# code, but the same can be done in VB.NET (VB.NET has a Using...End Using block, similar to C#'s using statement).
|
|
|
|
|
Much better than the Link microsoft you post.
Here is the vb.net version of your code.
Dim url = "http://www.perceler.com/getipadr1.php"
Dim req As HttpWebRequest = WebRequest.Create(url)
Dim resp As WebResponse = req.GetResponse()
Dim stream As Stream = resp.GetResponseStream()
Dim reader As New StreamReader(stream)
Debug.Print(reader.ReadToEnd)
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
OK.
However you should call Close or use a Using...EndUsing construct to clean up the WebResponse, Stream and StreamReader.
|
|
|
|
|
i have a dataset consisting of 3 tables table 1 is for insert , 2 for update and 3 for delete. if row one from table 1 is inserted only then row one from table 2 should be updated and so is with table 3. if any operation fails then all the data of row one from all three table should not happen. then they should move to next row.
one way is i use a for loop and apply transaction to the command and use logic for update and delete transaction.
but is there a way in .net where i can use transaction to a datatable and sync insert , update and delete operation between 3 tables.
|
|
|
|
|
nitin_ion wrote: but is there a way in .net where i can use transaction to a datatable and sync insert , update and delete operation between 3 tables.
Not that I know of. Your design sounds like a horror.
You could move the processing into a stored procedure but it would still be 3 operations wrapped in a transaction.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I am beginner in Visual Basic and i am using Visual Basic 2008 Express. I would like to do the following from a Visual Basic progrma:
a) Create a Microsoft Access Table with primary key and columns (Name, Address, Country, Tel No)
b) Insert records into the Access Table, after getting user input for Name, Address, Country and Tel No via textboxes
Can anyone kindly advise me some sample codes using the OleDBCommand? I tried to googling around but i'm stuck with creating the Access table with primary key.
Thank you very much for your kind help.
Regards,
|
|
|
|
|
If you download the VS2008 Samples[^], you will find examples of how to do this sort of thing in the Data Samples directory.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi to all,
Can we disable the right click of the mouse, (so that when my application runs teh user cannot do right click on the task bar and ends the process of my application)
thanks
|
|
|
|
|
You cannot stop the user from ending your application. All they would have to do is start TaskManager click on your app in the Process tab and click End Process.
|
|
|
|
|
Your requirement sounds far too suspicious for anyone to help.
जय हिंद
|
|
|
|
|
Hello,
I created a form in designer view with image bitmaps on them. I cannot do much in my code according to the compiler error that I have the images as read-only.
None of the images can be set to a value of image; windows.systems.forms.bitmaps doesn't allow it.
Any help on how I can make the form write and read or parts of the form, like the images that I want to move on the form would be appreciated.
Thank you in advance.
|
|
|
|
|
Your description makes no sense at all. I have no idea what controls and properties you're talking about that are "ReadOnly". If you ran your project and then went back to Visual Studio to make changes, and your app is still running, then, yes, nearly everything is going to be ReadOnly. You have to stop the app first, then make the changes in the designer.
|
|
|
|
|
I did stop the app and looked in designer view, but there is no attribute I can set for the property of the form to be writable. Basically, I'm trying to move images on one part of the screen to the top of other images on the other side of the screen, in a drag drop operation. It doesn't work as I thought; I read several tutorials and tried different code, but nothing seems to move on the form at run-time.
I hope this is a better explanation.
|
|
|
|
|
ymilan wrote: I did stop the app and looked in designer view, but there is no attribute I can set for the property of the form to be writable.
There is no such property. All of the controls on a form are static, meaning, you cannot move them around with the mouse.
YOU have to provide the code that will handle what happens when the user holds the mouse down on a control and moves the mouse around. This is not going to be a trivial task for a beginner. It requires in depth knowledge of how controls and mouse events work.
I wrote up an article on how to do this very thing with Label controls. You can read it here[^].
|
|
|
|
|
So there is no way to just set the form to be writable off the bat?
I tried several mouseover, mousemove events that I found on net tutorials. None of them worked. HEre is code I have so far.
Private Sub Image1_DragEnter(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DragEventArgs) _
Handles Image1.DragEnter
Dim Button As Short
If (e.Data.GetDataPresent(DataFormats.Bitmap)) Then
If (Button = VB6.MouseButtonConstants.LeftButton) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.Move
End If
End Sub
'Private Sub Hearts_DragDrop(ByVal sender As Object, _
'ByVal e As System.Windows.Forms.DragEventArgs) _
'Handles Hearts.DragDrop
'Hearts.Item = e.Data.GetData(DataFormats.Bitmap)
'End Sub
Private Sub Hearts_DragOver(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DragEventArgs) _
Handles Hearts.DragOver
End Sub
Private Sub Clubs_DragOver(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DragEventArgs) _
Handles Clubs.DragOver
End Sub
Private Sub Hearts_DragLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Hearts.DragLeave
End Sub
Private Sub Clubs_DragLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Clubs.DragLeave
Sorry I'm a newbie, but I'm really trying....much appreciation in advance.
|
|
|
|
|
Would this be a sound article to study?
<a href="http://www.startvbdotnet.com/forms/mouse.aspx">http://www.startvbdotnet.com/forms/mouse.aspx</a>[<a href="http://www.startvbdotnet.com/forms/mouse.aspx" target="_blank" title="New Window">^</a>]
|
|
|
|
|
It's a very brief overview, but it's a decent place to start.
|
|
|
|
|
ymilan wrote: So there is no way to just set the form to be writable off the bat?
There is simply no such thing. If you want to move controls around on the form at run-time, you have to write the code that provides such functionality. It is NOT built into the Form, nor anywhere else in the .NET Framework.
|
|
|
|
|
Ok, now I've read many tutorials and examples of mousemove, dragenter, and dragover. The main problem right now that I'm having is I'm trying to move a picturebox array. I keep getting compiler errors that value of type system.drawing.image is not a valid member or type of picturebox array.
I've looked up on MSDN the properties of pictureboxarray and it does show dragenter, dragover, and mousemove. However, I'm not finding any examples of how I can use the picturebox array to move the images I have on design view.
In VB6, all I had to do is set oledragdrop to true and it worked.
Any ideas on where or how I should accomplish this is much appreciated.
Hopefully I'm explaining a little bit better now. Thank you for your expertise.
|
|
|
|